<template>
	<view class="box">
		<view class="header">
			<view class="wrap">
				<view class="bc" @click="bk">
					<image src="../../static/img/fanhui.png" mode=""></image>
				</view>
				<view class="search">
					<image src="../../static/img/00b0ff.png" mode=""></image>
					<input type="text" value="" placeholder="搜索" v-model="input" @confirm="search" confirm-type="search" />
				</view>
				<view class="right" @click="bk">
					<text>取消</text>
				</view>
			</view>
		</view>

		<view class="history">
			<view class="title">
				<image src="../../static/img/shijian.png" mode=""></image>
				<text>最近搜索</text>
			</view>
			<view class="itemlist">
				<view class="item">公益</view>
				<view class="item">公益志愿活动</view>
			</view>
		</view>

		<view class="occupant">
			<image src="../../static/img/DKGW26Z1F74%5BJX4M9MPU0QI.png" mode=""></image>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				historyL: [],
				input: ""
			}
		},
		methods: {
			bk() {
				uni.navigateBack({})
			},
			async search() {
				let res = await uni.request({
					url: this.$config.basisIP,
					method: "POST",
					data: {
						fun: "search",
						context: this.input
					},
					header: {
						"content-type": "application/x-www-form-urlencoded"
					}

				})
				
				res = res[1].data.result
				if (!res[0]) {
					uni.showToast({
						title: "无相关内容",
						image: "../../static/img/tubiao8-.png"
					})
				}
				
				
				// uni.request({
				// 	url: this.$config.basisIP,
				// 	method: "POST",
				// 	data: {
				// 		fun: "search_onclick",
				// 		onclick_type: "porject",

				// 	}
				// })
			}
		},
		created() {

		}
	}
</script>

<style lang="scss" scoped>
	.box {
		min-height: 100vh;
		overflow: hidden;
		background: #fff;
		padding: 0 20rpx;

		.header {
			position: fixed;
			top: 0;
			left: 0;
			right: 0;
			background-color: $yellow;

			.wrap {
				display: flex;
				align-items: center;
				padding: 10rpx;

				.bc {
					image {
						width: 36rpx;
						height: 36rpx;
						margin-right: 20rpx;
					}
				}

				.search {
					flex: 1;
					display: flex;
					background-color: #fff;
					align-items: center;
					padding: 5rpx;

					image {
						width: 36rpx;
						height: 36rpx;
						margin-right: 10rpx;
					}

					input {
						flex: 1;
						height: 100%;
					}
				}

				.right {
					font-size: 25rpx;
					margin-left: 20rpx;
				}
			}
		}

		.history {
			margin-top: 100rpx;

			.title {
				display: flex;
				align-items: center;

				image {
					width: 36rpx;
					height: 36rpx;
				}

				text {
					margin-left: 5rpx;
					font-size: 25rpx;
					color: $subColor;
				}
			}

			.itemlist {
				margin-top: 10rpx;
				display: flex;
				flex-wrap: wrap;

				.item {
					padding: 15rpx;
					border-radius: 90rpx;
					background-color: rgba(229, 229, 234, 0.48);
					margin-right: 10rpx;
					font-size: 25rpx;
				}
			}
		}

		.occupant {
			position: fixed;
			bottom: 25rpx;
			left: 50%;
			transform: translateX(-50%);
			width: 685rpx;
			height: 207rpx;

			image {
				width: 100%;
				height: 100%;
				border-radius: 10rpx;
			}
		}
	}
</style>
